﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="searchTeacherData.aspx.cs" Inherits="Staff_EditCourseData" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>查詢教師資料</title>
    <style type="text/css">



        .style1
        {
            font-family: 微軟正黑體;
            font-size: xx-large;
            text-align: center;
        }
        .style2
        {
            text-align: center;
        }
        .style3
        {
            width: 80%;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div class="style2">
    
        <span class="style1">查詢教師資料</span><br />
        <br />
        <table align="center" class="style3">
            <tr>
                <td colspan="2">
                    請輸入欲查詢的教師名稱：<asp:TextBox ID="TextBox2" runat="server" ValidationGroup="phone"></asp:TextBox>
&nbsp;<asp:Button ID="Button1" runat="server" Text="查詢" ValidationGroup="phone" 
                        onclick="Button1_Click" Height="21px" />
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td colspan="2">
                        <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" 
                            CellPadding="4" DataKeyNames="TeacherId" DataSourceID="SqlDataSource1" 
                            ForeColor="#333333" GridLines="None" Height="50px" 
                            style="text-align: center" Width="338px">
                            <AlternatingRowStyle BackColor="White" />
                            <CommandRowStyle BackColor="#D1DDF1" Font-Bold="True" />
                            <EditRowStyle BackColor="#2461BF" />
                            <EmptyDataTemplate>
                                無資料
                            </EmptyDataTemplate>
                            <FieldHeaderStyle BackColor="#DEE8F5" Font-Bold="True" />
                            <Fields>
                                <asp:BoundField DataField="TeacherId" HeaderText="教師序號" ReadOnly="True" 
                                    SortExpression="TeacherId" />
                                <asp:BoundField DataField="TeacherName" HeaderText="教師名稱" 
                                    SortExpression="TeacherName" />
                                <asp:BoundField DataField="Email" HeaderText="電子信箱" SortExpression="Email" />
                                <asp:BoundField DataField="Lab" HeaderText="實驗室" 
                                    SortExpression="Lab" />
                                <asp:BoundField DataField="Degree" HeaderText="學位" 
                                    SortExpression="Degree" />
                            </Fields>
                            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                            <RowStyle BackColor="#EFF3FB" />
                        </asp:DetailsView>
                    </td>
            </tr>
            <tr>
                <td colspan="2">
                    <br />
                    <br />
                    <asp:HyperLink ID="HyperLink1" runat="server" 
                        NavigateUrl="~/Student/loopUpForGrade.aspx">回成績查詢</asp:HyperLink>
                </td>
            </tr>
        </table>
        <br />
        <br />
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ProjectConnectionString %>" 
            
            SelectCommand="SELECT [TeacherId], [TeacherName], [Email], [Lab], [Degree] FROM [Teacher] WHERE ([TeacherId] = @TeacherId)">
            <SelectParameters>
                <asp:SessionParameter DefaultValue="" Name="TeacherId" SessionField="teacherId" 
                    Type="Int32" />
            </SelectParameters>
        </asp:SqlDataSource>
    
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ProjectConnectionString %>" 
            
            SelectCommand="SELECT [TeacherId], [TeacherName], [Email], [Lab], [Degree] FROM [Teacher] WHERE ([TeacherName] = @TeacherName)">
            <SelectParameters>
                <asp:ControlParameter ControlID="TextBox2" Name="TeacherName" 
                    PropertyName="Text" Type="String" />
            </SelectParameters>
        </asp:SqlDataSource>
    
        <br />
    
    </div>
    </form>
</body>
</html>
